# famous fizzbuzz program

printNum: # prints number <= 100
  $0 100 = ?
    ^ 
    0 "100" -->
    !.
  .

  $0 10 >= ?
    $0 10 / "0" + ->
    10 %
  .

  "0" + ->
.

1                   # i (counter)
@@
  $0 100 > ?
    !@
  .

  $0 1 != ?         # print comma before every but first number
    "," -> " " ->
  .

  $0 3 % 0 = $1 5 % 0 = 2 * |  # (i % 3 == 0) | ((i % 5 == 0) << 1)

  $0 0 = ?
    $1 printNum
  ;
    $0 1 & ?
      0 "Fizz" -->
    .

    $0 3 = ?
      " " ->
    .

    $0 2 & ?
      0 "Buzz" -->
    .
  .

  ^
  ++
.
^
